﻿Namespace Logic.Contracts

    Public Class cContractUMP
        Inherits cContractBase

#Region "Constractor"
        Sub New(ByVal ContractType As String,
                ByVal ContractID As String,
                ByVal ContractBalance As Double?,
                ByVal ContractCurrency As String,
                ByVal ContractIntresetRate As Double?,
                ByVal ContractMaturityDate As Date?,
                ByVal ContractReportDate As Date,
                ByVal ContractMajorGroup As String,
                ByVal ContractProductCode As String,
                Optional ByVal ProductDiscription As String = "",
                Optional ByVal ProductTag As String = "",
                Optional ByVal ProductResponsableGL As String = "")


            MyBase.New()
            Me.ContractID = ContractID
            Me.ContractType = ContractType
            Me.Currency = ContractCurrency
            Me.Balance = ContractBalance
            Me.InterestRate = ContractIntresetRate
            Me.MaturityDate = ContractMaturityDate
            Me.ReportDate = ContractReportDate
            Me.ContractMajorGroup = ContractMajorGroup
            Me.ContractProductCode = ContractProductCode
            Me.ContractProductDiscription = ProductDiscription
            Me.ContractTag = ProductTag
            Me.ResponsableGL = ProductResponsableGL


            Me.CalculateRemainingSeltelemntsNumber()
        End Sub
#End Region

#Region "Methods"
        Public Overrides Function CalculatePaymnetSchedaul() As System.Collections.Generic.List(Of MdulLogic.PaymentSchedual)

            Dim PymtDate As Date
            PymtDate = CDate(ReportDate).AddDays(1)

            Dim pymt As PaymentSchedual

            With pymt
                .strCurrency = Currency
                .intPaymentOrder = 0
                .intPaymentDays = DateDiff("d", ReportDate, PymtDate)
                .dblPrincipalPayment = Balance
                .dblInterestPayment = (Balance * InterestRate * .intPaymentDays) / 365
                .dblPaymentAmount = .dblInterestPayment + .dblPrincipalPayment
                .dtePaymentDate = PymtDate
                .strTenor = "'" & GetTenor(.intPaymentDays) & "'"
            End With
            _PaymentSchedual.Add(pymt)
            Return _PaymentSchedual
        End Function

        Public Overrides Function CalculateRemainingSeltelemntsNumber() As Integer
            _CalculateRemainingSeltelemntsNumber = 1
            Return _CalculateRemainingSeltelemntsNumber
        End Function
#End Region

    End Class
End Namespace